//
//  ViewController.m
//  UIPageViewController
//
//  Created by 王忠迪 on 9/13/16.
//  Copyright © 2016 王忠迪. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UIPageViewControllerDataSource>

@end

/**
 *  - (void)setViewControllers:(nullable NSArray<UIViewController *> *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^ __nullable)(BOOL finished))completion;

 */

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    UIViewController *vc1 = [[UIViewController alloc] init];
//    
//    vc1.view.backgroundColor = [UIColor blueColor];
//    
//    UIViewController *vc2 = [[UIViewController alloc] init];
//    
//    vc2.view.backgroundColor = [UIColor redColor];
//    
//    [self setViewControllers:@[vc1,vc2] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) {
//        
//    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark -- 数据源方法

/**
 *  - (nullable UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController;
 - (nullable UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController;
 */

//- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
//{
//    return 2;
//}

- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation __TVOS_PROHIBITED;
{
    return UIPageViewControllerSpineLocationMid;
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
    UIViewController *vc1 = [[UIViewController alloc] init];
    
    vc1.view.backgroundColor = [UIColor blueColor];
    
    return vc1;
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
{
    UIViewController *vc2 = [[UIViewController alloc] init];
    
    vc2.view.backgroundColor = [UIColor redColor];
    
    return vc2;
}

@end
